/*
 @function ajax验证登录
 @update by zhubingyi , 2018/11/28
*/ 
function login(){
	var username = document.getElementById("adminname").value;
	var password = document.getElementById("adminpassword").value;
	if(username == ""||password == ""){
		if(username == ""){
			alert("请输入用户名");
			return false;
		}
		if(password == ""){
			alert("请输入密码");
			return false;
		}
		return;
	}else{
		var user_json={
				   "adminname" : username,
		           "adminpassword" : password
	           };
	    var json_str=JSON.stringify(user_json);
		$.ajax({
			dataType : "json",
			type : "post",
			traditional:true,
			contentType:"application/json; charset=utf-8",//防止乱码
			data : json_str,
			url : "./UserAdmin/login.do",
		    success : function(msg){
				if(msg=='1'){
					alert("登录成功！");
					document.location.href = "./UserAdmin/gomain.do";
					return;
				}else{
				    alert("登录失败！");
				    return;
				}
		}
	});
  }	
}
